<%@ page language="java"
	import="java.util.*,com.chj.entity.*,com.chj.constants.Constants"
	pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		
		<title>登录</title>

		<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"  >
		<link type="text/css" rel="stylesheet" href="css/easyui/themes/default/easyui.css" />
		<link type="text/css" rel="stylesheet" href="css/evtcar.css" />
		<link type="text/css" rel="stylesheet" href="css/person/userInf.css" />
		<link type="text/css" rel="stylesheet" href="font-awesome/css/font-awesome.min.css" />
		<link type="text/css" rel="stylesheet" href="css/demo.css" />
		<link type="text/css" rel="stylesheet" href="css/easyui/themes/icon.css" />

		<script type="text/javascript" src="js/jquery/1.6/jquery-1.6.min.js"></script>
        <script type="text/javascript" src="js/easyui/1.4/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="js/easyui/1.4/easyui-lang-zh_CN.js"></script>
	    <script type="text/javascript" src="js/staticinfo.js"></script>
	    <script type="text/javascript" src="js/login.js"></script>

		<script type="text/javascript">
function mes(a, b, c) {
	alert(a + b + c);
};

$(function() {

	$("#queryButton").click(function() {

		var i = 1;

		$(".easyui-validatebox").each(function() {
			if ($(this).val() == "") {
				mes('系统提示', '请把信息填写完整!', 'warning');
				i = 0;
				return false;
			}
		});

		if (i == 1) {
			ajaxSubmit();
		}
	});
});

function removeUnTimeFormat(time){
	time.replace(':','');
}

function removeTimeFormat(time){
	var timeFormat = time.substring(0,2) + ':' + time.substring(2,4);
	return timeFormat;
}

function ajaxSubmit() {

	var networkName = $('#networkName').val();
	var networkParkSize = $('#networkParkSize').val();
	var networkProvince = $('#networkProvince').val();
	var networkCity = $('#networkCity').val();
	var networkArea = $('#networkArea').val();
	var networkAddress = $('#networkAddress').val();
	var networkPrice = $('#networkPrice').val();
	var networkTimeBegin = removeUnTimeFormat($('#networkTimeBegin').val());
	var networkTimeEnd = removeUnTimeFormat($('#networkTimeEnd').val());
	var networkType = $('#networkType').find('option:selected').attr('value');

	//get parameter
	var netWorkStr = {
		networkName : networkName,
		networkParkSize : networkParkSize,
		networkProvince : networkProvince,
		networkCity : networkCity,
		networkArea : networkArea,
		networkAddress : networkAddress,
		networkPrice : networkPrice,
		networkTimeBegin : networkTimeBegin,
		networkTimeEnd : networkTimeEnd,
		networkType : networkType
	}

	$.ajax({type:"post",
               dataType:"text",
               timeout:30000,
               async:true,
               url:"ecarcharge/queryNetwork.do",
               data:{netWorkStr:JSON.stringify(netWorkStr)},
               contentType: "application/x-www-form-urlencoded; charset=utf-8",
               success:function (data) {

                    var resultMap =  eval('(' + data + ')');

                    if (resultMap.netWorkList.length > 0 ) {

                    	$('#detail').empty();

                    	var html = '查询到 '+resultMap.netWorkList.length+'条记录';

                    	$.each(resultMap.netWorkList, function(i,netWork){

							html += ' <table border="1px" cellspacing="0px" class="table">                                                        ';
							html += '   <tr>                                                                                                      ';
							html += '       <td rowspan="3" class="success" width="30%"><p class="success" >' + netWork.networkName + '</p></td>  ';
							html += '       <td colspan="2">网点总车位:'+ netWork.networkParkSize +' (个)</td>                                                  ';
							html += '       <td rowspan="3" align="right" valign="middle" style="line-height:100px "><a class="btn btn-primary" href="ecarcharge/query_network/'+netWork.networkId+'.do"><i class="icon-align-right"></i>选择网点</a></td>                 ';
							html += '   </tr>                                                                                                     ';
							html += '   <tr>                                                                                                      ';
							html += '       <td>网点营业开始时间：'+ removeTimeFormat(netWork.networkTimeBegin) +'</td>';
							html += '       <td>网点地址:' + netWork.networkProvince + netWork.networkCity + netWork.networkArea + netWork.networkAddress + '</td>';
							html += '   </tr>                                                                                                     ';
							html += '   <tr>                                                                                                      ';
							html += '       <td>网点营业结束时间：'+ removeTimeFormat(netWork.networkTimeEnd) +'</td>';
							html += '       <td>网点单价:'+ netWork.networkPrice +' (元/小时)</td>                                                            ';
							html += '   </tr>                                                                                                     ';
							html += ' </table>                                                                                                    ';
                        });

                    	$('#detail').append(html);
                    } else {

                    	$('#detail').empty();
                    	$('#detail').append('查询无结果');
                    }
               },
               error:function (XMLHttpRequest, textStatus, errorThrown) {
            	   console.log(XMLHttpRequest.status);
            	   console.log(XMLHttpRequest.readyState);
            	   console.log(textStatus);
               }
       });

}
</script>
	</head>
	<body>
	    </header>
		<!--顶部导航栏开始 -->
		<%@include file="head.jsp"%>
		<!--下面是中部导航栏的代码-->
		<div class="nav-green nav-head" id="J_m_nav">
			<div class="nav-content">
				<div class="nav-btn">
					<a href="index.do">首页</a>
				</div>
				<div class="nav-btn active">
					<a href="ecarcharge/we_need_charge.do">我要充电</a>
				</div>
				<div class="nav-btn">
					<a href="person/person_center.do">个人中心</a>
				</div>
				<div class="nav-btn">
					<a href="about_me.do">关于我们</a>
				</div>
				<div class="nav-btn"><a href="person/person_help.do">用户帮助</a></div>
			</div>
		</div>
		</header>
		<!--顶部导航栏结束 -->

		<form action="loginSubmit" method="post" class="form-search"
			onsubmit="checklogin();return false;">

			<div id="page" class="page" style="width: 1024px;min-height:400px;*+height:100%;_height:400px;margin: 0 auto;">
				<p class="bg-primary">
					查询选择网点
				</p>
				<table class="table">
					<tr>
						<td>
							<table width="950px">
								<tr>
									<td>
										网点名称：
									</td>
									<td>
										<input id="networkName" name="networkName" type="text"
											class="input-medium search-query" />
									</td>
									<td>
										网点车位数量：
									</td>
									<td>
										<input id="networkParkSize" name="networkParkSize" type="text"
											class="input-medium search-query" />
									</td>
									<td>
										网点省份：
									</td>
									<td>
										<input id="networkProvince" id="networkProvince" type="text"
											class="input-medium search-query" name="networkProvince" />
									</td>
								</tr>
								<tr>
									<td>
										网点城市：
									</td>
									<td>
										<input id="networkCity" type="text" class="input-medium search-query"
											name="networkCity" />
									</td>
									<td>
										网点地区：
									</td>
									<td>
										<input id="networkArea" type="text" class="input-medium search-query"
											name="networkArea" />
									</td>
									<td>
										网点价格（元/小时）：
									</td>
									<td>
										<input id="networkPrice" name="networkPrice" type="text"
											class="input-medium search-query" />
									</td>
								</tr>
								<tr>
									<td>
										网点营业时间开始：
									</td>
									<td>
										<input id="networkTimeBegin" name="networkTimeBegin"
											type="text" class="easyui-timespinner" type="text"
											value="08:00" />
									</td>
									<td>
										网点营业结束时间：
									</td>
									<td>
										<input id="networkTimeEnd" name="networkTimeEnd" type="text"
											class="easyui-timespinner" type="text" value="20:00" />
									</td>
									<td>
										网点类型：
									</td>
									<td>
										<select id="networkType" name=”networkType”
											class=”easyui-combobox” style="">
											<option id="1" value="1" selected="selected">
												普通网点
											</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
						<td>
							<td width="100px">
								<table width="50px">
									<tr>
										<td>
										</td>
									</tr>
									<tr>
										<td>
										</td>
									</tr>
									<tr>
										<td>
											<button id="queryButton" name="queryButton" type="button"
												class="btn" value="查询">
												查询
											</button>
										</td>
									</tr>
								</table>
							</td>
						</td>
					</tr>
				</table>
				<div>
					<div id="detail">
					</div>
				</div>
			</div>
			<%@include file="footer.jsp"%>
		</form>
	</body>
</html>
